package com.ankicoo.office.controller;

import com.zhuozhengsoft.pageoffice.OpenModeType;
import com.zhuozhengsoft.pageoffice.PageOfficeCtrl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * Description:
 *
 * @author : QCYANG
 * @date : 2022/2/25 11:28
 */
@Controller
public class PageOfficeController {
    /**
     * 查看word
     *
     * @param request
     * @param map
     * @return
     */
    @RequestMapping(value = "/word", method = RequestMethod.GET)
    public String showWord(HttpServletRequest request, Map<String, Object> map) {
        //--- PageOffice的调用代码 开始 -----
        PageOfficeCtrl poCtrl = new PageOfficeCtrl(request);
        poCtrl.setServerPage("/poserver.zz");//设置授权程序servlet
        poCtrl.webOpen("d:\\test.doc", OpenModeType.docAdmin, "张三");
        map.put("pageoffice", poCtrl.getHtmlCode("PageOfficeCtrl1"));
        //--- PageOffice的调用代码 结束 -----
//        ModelAndView mv = new ModelAndView("Word");
        return "openWord";
    }

    @RequestMapping("/newword")
    public String tonewword() {
        return "openWord";
    }
}
